{include file="public/top" /}

<body>
<div class="x-body">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">
                <input type="hidden" value="{$data.id}" name="id">
                <span class="x-red">*</span>名称
            </label>
            <div class="layui-input-block">
                <input type="text"  value="{$data.name}" disabled required="" 
                       autocomplete="off" class="layui-input">
            </div>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>公司
            </label>
            <div class="layui-input-block">
                <input type="text"  disabled value="{$data.com}" required="" 
                       autocomplete="off" class="layui-input">
            </div>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>邮箱
            </label>
            <div class="layui-input-block">
                <input type="text"  disabled name="email" value="{$data.email}" required="" 
                       autocomplete="off" class="layui-input">
            </div>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>电话
            </label>
            <div class="layui-input-block">
                <input type="text"  disabled value="{$data.tel}" required="" 
                       autocomplete="off" class="layui-input">
            </div>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>国家
            </label>
            <div class="layui-input-block">
                <input type="text"  disabled value="{$data.country}" required="" 
                       autocomplete="off" class="layui-input">
            </div>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>留言内容
            </label>
            <div class="layui-input-block">
                <textarea required  disabled placeholder="请输入" class="layui-textarea" style="height: 200px">{$data.content}</textarea>
            </div>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>分配状态
            </label>
            <div class="layui-input-inline">

                <select id="status" name="status" class="valid">
                    <option value="1" {if $data.status eq 1}selected="selected"{/if}>未分配</option>
                    <option value="2" {if $data.status eq 2}selected="selected"{/if}>已分配，未处理</option>
                    <option value="3" {if $data.status eq 3}selected="selected"{/if}>已处理</option>
                </select>
            </div>
            <br>
            <br>
            <br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>选择业务员
            </label>
            <div class="layui-input-inline">

                <select id="salesman_id" name="salesman_id" class="valid">
                    {volist name="slist" id="v"}
                    <option value="{$v.id}" {if $v.id eq $data.salesman_id}selected="selected"{/if}>{$v.name}</option>
                    {/volist}
                </select>
            </div>
            <br><br><br>
            <label  class="layui-form-label">
                <span class="x-red">*</span>抄送
            </label>
            <div class="layui-input-block">
                <input type="text" name="copy_to" value="{$data.copy_to}" required="" 
                       autocomplete="off" class="layui-input">
            </div>


        </div>

        <div class="layui-form-item">
            <button type="button"  class="layui-btn layui-btn-normal" lay-filter="add" lay-submit="">提交</button>
        </div>
    </form>
</div>
<script>

    var addurl = '/admin/contactus/reply';

    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data){
            $.post(addurl, data.field,function(res) {
                var success = JSON.parse(res);
                if(success.code===200){
                    layer.msg(success.msg, {
                        time: 1000, //不自动关闭
                        icon:6,
                        end:function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        }
                    });
                    return false;
                }else {
                    layer.msg(success.msg)
                }


            });

        });
    });

</script>


</body>

</html>